/*
 * @Author: your Name
 * @Date: 2021-11-24 14:08:14
 * @LastEditors: your Name
 * @LastEditTime: 2022-06-28 10:27:58
 * @Description: 
 */
async function foo() {
  console.log("foo function start~")

  console.log("中间代码~")

  console.log("foo function end~")

  // 1.返回一个值
  return 'heheh'
  // 2.返回thenable
  // return {
  //   then: function(resolve, reject) {
  //     resolve("hahahah")
  //   }
  // }

  // 3.返回Promise
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      resolve("hehehehe")
    }, 2000)
  })
}

// 异步函数的返回值一定是一个Promise
const promise = foo()
console.log(promise)
// promise.then(res => {
//   console.log("promise then function exec:", res)
// })
